<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function rev(str) {
        let r = "";
        for (let v of str) {
          r = v + r;
          // r = r + v;
        }
        return r;
      }
      console.log(rev("abcde")); //edcba
    </script>
  </body>
</html>
